package uk.co.entropedia.display
{
	import com.bit101.components.Component;
	import com.bit101.components.Label;
	
	import flash.display.DisplayObjectContainer;
	import flash.events.Event;
	import flash.text.TextFieldAutoSize;
	
	public class LabelHTML extends Label
	{
		public function LabelHTML(parent:DisplayObjectContainer=null, xpos:Number=0, ypos:Number=0, text:String="")
		{
			super(parent, xpos, ypos, text);
		}
		
		/**
		 * 
		 */
		override public function draw():void
		{
			dispatchEvent(new Event(Component.DRAW));
			_tf.htmlText = _text;
			if(_autoSize)
			{
				_tf.autoSize = TextFieldAutoSize.LEFT;
				_width = _tf.width;
				dispatchEvent(new Event(Event.RESIZE));
			}
			else
			{
				_tf.autoSize = TextFieldAutoSize.NONE;
				_tf.width = _width;
			}
			_height = _tf.height = 18;
			
			_tf.selectable = true;
			_tf.mouseEnabled = true;
			mouseChildren = true;
			mouseEnabled = true;
		}
	}
}